package setting

func response(message string, lang string) string {
	responseZH := map[string]string{
		"saveSuccess":                "保存成功",
		"saveFail":                   "保存失败",
		"restartSuccess":             "重启成功",
		"generateSuccess":            "世界生成成功",
		"addAdmin":                   "添加管理员成功",
		"addAdminFail":               "添加管理员失败",
		"addBlock":                   "添加黑名单成功",
		"addBlockFail":               "添加黑名单失败",
		"addWhite":                   "添加白名单成功",
		"addWhiteFail":               "添加白名单失败",
		"deleteAdmin":                "删除管理员成功",
		"deleteAdminFail":            "删除管理员失败",
		"deleteBlock":                "删除黑名单成功",
		"deleteBlockFail":            "删除黑名单失败",
		"deleteWhite":                "删除白名单成功",
		"deleteWhiteFail":            "删除白名单失败",
		"kickSuccess":                "踢出成功",
		"kickFail":                   "踢出失败",
		"uploadSuccess":              "上传成功",
		"uploadFail":                 "上传失败",
		"wrongUploadFile":            "导入文件未通过校验",
		"deleteOldServerFail":        "删除旧服务器文件失败",
		"createNewServerFail":        "创建新服务器文件失败",
		"writeToDBFail":              "写入数据库失败",
		"needDownload":               "请先下载模组",
		"downloading":                "正在下载中，请稍后",
		"syncModFail":                "同步失败",
		"syncModSuccess":             "同步成功",
		"deleteModFail":              "删除模组失败",
		"deleteModSuccess":           "删除模组成功",
		"configUpdateSuccess":        "修改成功",
		"enableModSuccess":           "添加模组成功",
		"disableModSuccess":          "禁用模组成功",
		"gameServerNotCreated":       "未发现游戏配置，请前往设置-房间页面进行创建",
		"exportSuccess":              "模组导出成功",
		"updateModSuccess":           "模组更新成功",
		"updateModFail":              "模组更新失败",
		"createSuccess":              "创建成功",
		"clusterExisted":             "集群已存在",
		"saveSuccessRestartFail":     "保存成功，重启失败",
		"importSuccessSaveFail":      "导入文件检查通过，保存失败，服务器内部错误",
		"executed":                   "已执行操作",
		"cleanHistoryPlayersFail":    "清空历史玩家失败",
		"cleanHistoryPlayersSuccess": "清空历史玩家成功",
		"complicatedMod":             "含有复杂配置模组，请前往房间设置手动修改",
	}
	responseEN := map[string]string{
		"saveSuccess":                "Save Success",
		"saveFail":                   "Save Fail",
		"restartSuccess":             "Restart Success",
		"generateSuccess":            "Generate World Success",
		"addAdmin":                   "Successfully added administrator",
		"addAdminFail":               "Failed to add administrator",
		"addBlock":                   "Successfully added to blacklist",
		"addBlockFail":               "Failed to add to blacklist",
		"addWhite":                   "Successfully added to whitelist",
		"addWhiteFail":               "Failed to add to whitelist",
		"deleteAdmin":                "Successfully deleted administrator",
		"deleteAdminFail":            "Failed to deleted administrator",
		"deleteBlock":                "Successfully deleted to blacklist",
		"deleteBlockFail":            "Failed to deleted to blacklist",
		"deleteWhite":                "Successfully deleted to whitelist",
		"deleteWhiteFail":            "Failed to deleted to whitelist",
		"kickSuccess":                "Kick Success",
		"kickFail":                   "Kick Fail",
		"uploadSuccess":              "Upload Success",
		"uploadFail":                 "Upload Fail",
		"wrongUploadFile":            "The import file did not pass validation",
		"deleteOldServerFail":        "Failed to delete old server files",
		"createNewServerFail":        "Failed to create new server files",
		"writeToDBFail":              "Writing to database failed",
		"needDownload":               "Please download MOD first",
		"downloading":                "Downloading... Please wait",
		"syncModFail":                "Sync Fail",
		"syncModSuccess":             "Sync Success",
		"deleteModFail":              "Delete Mod Fail",
		"deleteModSuccess":           "Delete Mod Success",
		"configUpdateSuccess":        "Update Success",
		"enableModSuccess":           "Add MOD Success",
		"disableModSuccess":          "Disable MOD Success",
		"gameServerNotCreated":       "Room Setting Not Found, Please go to the Settings - Room page to create",
		"exportSuccess":              "MOD Export Success",
		"updateModSuccess":           "Mod Update Success",
		"updateModFail":              "Mod Update Fail",
		"createSuccess":              "Create Success",
		"clusterExisted":             "Cluster Existed",
		"saveSuccessRestartFail":     "Save Success, Restart Fail",
		"importSuccessSaveFail":      "File import verification passed, but save failed due to an internal server error.",
		"executed":                   "Command Executed",
		"cleanHistoryPlayersFail":    "Clean History Players Fail",
		"cleanHistoryPlayersSuccess": "Clean History Players Success",
		"complicatedMod":             "complicated Mod found, please go to room setting page to modify",
	}

	if lang == "zh" {
		return responseZH[message]
	} else {
		return responseEN[message]
	}
}

func responseImportError(message string, lang string) string {
	responseZH := map[string]string{
		"zipFileSave":             "文件保存失败",
		"createUnzipDir":          "解压目录创建失败",
		"unzipProcess":            "解压失败",
		"clusterIniNotFound":      "未发现cluster.ini文件",
		"clusterIniReadFail":      "读取cluster.ini文件失败",
		"cluster_name_NotSet":     "cluster.ini文件缺少字段cluster_name",
		"game_mode_NotSet":        "cluster.ini文件缺少字段game_mode",
		"clusterTokenNotFound":    "未发现cluster_token.txt文件",
		"clusterTokenReadFail":    "读取cluster_token.txt文件失败",
		"world_file_path_GetFail": "获取世界目录失败",
		"serverIniNotFound":       "未发现server.ini文件",
		"port_factor_GetFail":     "获取集群信息异常，请检查当前操作的集群",
		"is_master_NotSet":        "server.ini文件缺少字段is_master",
		"is_master_ValueError":    "server.ini字段is_master值异常",
		"master_ip_NotSet":        "cluster.ini文件缺少字段master_ip",
		"levelDataNotFound":       "未发现leveldataoverride.lua文件",
		"levelDataReadFail":       "读取leveldataoverride.lua文件失败",
		"worldNotEmpty":           "当前房间含有其他世界，请创建一个新集群后导入",
		"clusterDirCreateFail":    "创建集群目录失败，服务器内部错误",
		"copyFileFail":            "复制游戏数据文件失败，服务器内部错误",
	}
	responseEN := map[string]string{
		"zipFileSave":             "file save fail",
		"createUnzipDir":          "create zip dir fail",
		"unzipProcess":            "unzip fail",
		"clusterIniNotFound":      "cluster.ini not found",
		"clusterIniReadFail":      "read cluster.ini fail",
		"cluster_name_NotSet":     "the cluster.ini file is missing the cluster_name field",
		"game_mode_NotSet":        "the cluster.ini file is missing the game_mode field",
		"clusterTokenNotFound":    "cluster_token.txt not found",
		"clusterTokenReadFail":    "read cluster_token.txt fail",
		"world_file_path_GetFail": "read world dir fail",
		"serverIniNotFound":       "server.ini not found",
		"port_factor_GetFail":     "failed to retrieve cluster information. Please check the cluster you are currently operating on",
		"is_master_NotSet":        "the server.ini file is missing the is_master field",
		"is_master_ValueError":    "invalid value detected for 'is_master' field in server.ini configuration file",
		"master_ip_NotSet":        "the server.ini file is missing the master_ip field",
		"levelDataNotFound":       "leveldataoverride.lua not found",
		"levelDataReadFail":       "read leveldataoverride.lua fail",
		"worldNotEmpty":           "this cluster has valid world, please create new cluster to import",
		"clusterDirCreateFail":    "cluster directory creation failed due to an internal server error",
		"copyFileFail":            "Failed to copy game data files, internal server error",
	}

	if lang == "zh" {
		return responseZH[message]
	} else {
		return responseEN[message]
	}
}
